from django.conf.urls import url
from django.contrib import admin
from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import obtain_jwt_token
from meiduo_admin.views import users
from .views import statistical, specs, images, users, skus,permission,groups,options,spus,orders,admins

urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    # ----------------数据统计--------------
    # 用户总数统计
    url(r'^statistical/total_count/$', statistical.UserTotalCount.as_view()),
    # 日增用户统计
    url(r'^statistical/day_increment/$', statistical.UserDayCount.as_view()),
    # 日活用户统计
    url(r'^statistical/day_active/$', statistical.UserDayActiveCount.as_view()),
    # 下单用户用户统计
    url(r'^statistical/day_orders/$', statistical.UserDayOrdersCount.as_view()),

    # ----------------用户管理--------------
    url(r'^users/$', users.UsersView.as_view()),
    # ----------------规格管理--------------
    # url(r'^goods/simple/$', specs.SpecView.as_view({'get': 'simple'})),
    # ----------------图片管理--------------
    # url(r'^skus/simple/$', images.ImageView.as_view({'get': 'simple'})),

    # 获取权限类型
    url(r'^permission/content_types/$',permission.PermissionView.as_view({'get': 'content_types'})),
]
# ----------------规格管理--------------
router = DefaultRouter()
router.register('goods/specs', specs.SpecsView, base_name='specs')
urlpatterns += router.urls

# ---------------图片管理--------------
router = DefaultRouter()
router.register('skus/images', images.ImageView, base_name='images')
urlpatterns += router.urls


# ---------------SKU管理--------------
router = DefaultRouter()
router.register('skus', skus.SKUView, base_name='skus')
urlpatterns += router.urls


# ---------------订单表管理--------------
# router = DefaultRouter()
# router.register('orders', orders.OrderInfoView, base_name='orders')
# urlpatterns += router.urls


# ---------------权限表管理--------------
router = DefaultRouter()
router.register('permission/perms', permission.PermissionView, base_name='perms')
urlpatterns += router.urls

# ---------------分组表管理--------------
router = DefaultRouter()
router.register('permission/groups', groups.GroupView, base_name='groups')
# 管理员管理
router.register('permission/admins', admins.AdminView, base_name='admins')
router.register('specs/options', options.SpecificationOptionView, base_name='options')

router.register('goods', spus.SPUView, base_name='goods')
urlpatterns += router.urls
